#ifndef __CBUTTON_H__
#define __CBUTTON_H__

#include "cocos2d.h"

USING_NS_CC;

enum EnumButtonStatus
{
	BUTTON_STATUS_NONE,
	BUTTON_STATUS_UP,
	BUTTON_STATUS_DOWN,
	BUTTON_STATUS_SELECTED
};

#define BUTTON_CLICK_EVENT "button_touch_end_event"

class CButton : public CCSprite
{
public:
	virtual ~CButton();

	static CButton* create(const char* pszUpFileName, const char* pszDownFileName = NULL);
	CREATE_FUNC(CButton);

	void setStatus(EnumButtonStatus status);
	EnumButtonStatus getStatus();
	void setUpFile(const char* pszFileName);
	void setDownFile(const char* pszFileName);

	virtual bool init();

	char* pszButtonName;

private:
	CButton();

	EventListenerTouchOneByOne* listener;

	CCSprite* upStatus;
	CCSprite* downStatus;
	CCSprite* currentStatus;
	EnumButtonStatus _status;

	bool checkTouchInside(CCTouch *pTouch);
};

#endif